<?php

namespace app\admin\validate;

use think\Validate;

class Admin extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'username' => 'require|regex:\w{3,30}|max:20',
        'nickname' => 'require|max:20',
        'major' => 'integer|gt:0',
        'f_major' => 'require|max:255',
        'grade_group' => 'integer|gt:0',
        'business_administrator_id' => 'integer|gt:0',
        'personnel_manager_id' => 'integer|gt:0',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'username.require' => '账户不能为空',
        'username.max' => '账户填入过长',
        'username.regex' => '账号长度必须在3-30位之间的英文，不能包含空格',
        'nickname.require' => '姓名不能为空',
        'nickname.max' => '姓名填入过长',
        'major.integer' => '请选择主科',
        'major.gt' => '请选择主科',
        'f_major.require' => '科任不能为空',
        'f_major.max' => '科任选择过多',
        'grade_group.integer' => '请选择年级组',
        'grade_group.gt' => '请选择年级组',
        'business_administrator_id.integer' => '请选择业务管理员',
        'business_administrator_id.gt' => '请选择业务管理员',
        'personnel_manager_id.integer' => '请选择人事管理员',
        'personnel_manager_id.gt' => '请选择人事管理员',
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['username', 'nickname'],
        'teacher_add' => ['username', 'nickname','grade_group','business_administrator_id','personnel_manager_id'],
        'edit'  => ['nickname'],
        'teacher_edit'  => ['nickname','grade_group'],
        'admin_import' => ['username', 'nickname'],
    ];



}
